<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="chapter.css"?><chapter id="compact.xml">
  <title>Compact syntax reference guide</title>
  <simplesect>
    <para>Compact syntax reference guide</para>
  </simplesect>
  <sect1>
    <title>Introduction</title>
    <para>This quick reference guide is following the formal description of the compact syntax described as an EBNF grammar in its documentation. Each definition of the EBNF grammar is documented and when these definitions include a long list of alternatives (such as it is the case for <literal>pattern</literal>, <literal>nameClass</literal> or <literal>literalSegment</literal>), each alternative is documented separately. The grammar from the specification has also been slightly simplified to suppress definitions which were used only once but its meaning has been kept unchanged. Note that this grammar is a summary which does not include the definition of annotations.</para>
    <para>Here is the full EBNF which has been used as a basis for this guide:</para>
    <programlisting>
topLevel            ::= <emphasis>decl</emphasis>* (<emphasis>pattern</emphasis>|<emphasis>grammarContent</emphasis>*)
decl                ::= &quot;namespace&quot; <emphasis>identifierOrKeyword</emphasis> &quot;=&quot; <emphasis>namespaceURILiteral</emphasis>
                        |&quot;default&quot; &quot;namespace&quot; [<emphasis>identifierOrKeyword</emphasis>] &quot;=&quot; <emphasis>namespaceURILiteral</emphasis>
                        |&quot;datatypes&quot; <emphasis>identifierOrKeyword</emphasis> &quot;=&quot; <emphasis>literal</emphasis>
pattern             ::= &quot;element&quot; <emphasis>nameClass</emphasis> &quot;{&quot; <emphasis>pattern</emphasis> &quot;}&quot;
                        |&quot;attribute&quot; <emphasis>nameClass</emphasis> &quot;{&quot; <emphasis>pattern</emphasis> &quot;}&quot;
                        |<emphasis>pattern</emphasis> (&quot;,&quot; <emphasis>pattern</emphasis>)+
                        |<emphasis>pattern</emphasis> (&quot;&amp;&quot; <emphasis>pattern</emphasis>)+
                        |<emphasis>pattern</emphasis> (&quot;|&quot; <emphasis>pattern</emphasis>)+
                        |<emphasis>pattern</emphasis> &quot;?&quot;
                        |<emphasis>pattern</emphasis> &quot;*&quot;
                        |<emphasis>pattern</emphasis> &quot;+&quot;
                        |&quot;list&quot; &quot;{&quot; <emphasis>pattern</emphasis> &quot;}&quot;
                        |&quot;mixed&quot; &quot;{&quot; <emphasis>pattern</emphasis> &quot;}&quot;
                        |<emphasis>identifier</emphasis>
                        |&quot;parent&quot; <emphasis>identifier</emphasis>
                        |&quot;empty&quot;
                        |&quot;text&quot;
                        |[<emphasis>datatypeName</emphasis>] <emphasis>literal</emphasis>
                        |<emphasis>datatypeName</emphasis> [&quot;{&quot; <emphasis>param</emphasis>* &quot;}&quot;] [<emphasis>exceptPattern</emphasis>]
                        |&quot;notAllowed&quot;
                        |&quot;external&quot; <emphasis>literal</emphasis> [<emphasis>inherit</emphasis>]
                        |&quot;grammar&quot; &quot;{&quot; <emphasis>grammarContent</emphasis>* &quot;}&quot;
                        |&quot;(&quot; <emphasis>pattern</emphasis> &quot;)&quot;
param               ::= <emphasis>identifierOrKeyword</emphasis> &quot;=&quot; <emphasis>literal</emphasis>
exceptPattern       ::= &quot;-&quot; <emphasis>pattern</emphasis>
grammarContent      ::= <emphasis>start</emphasis>
                        |<emphasis>define</emphasis>
                        |&quot;div&quot; &quot;{&quot; <emphasis>grammarContent</emphasis>* &quot;}&quot;
                        |&quot;include&quot; <emphasis>literal</emphasis> [<emphasis>inherit</emphasis>] [&quot;{&quot; <emphasis>includeContent</emphasis>* &quot;}&quot;]
includeContent      ::= <emphasis>define</emphasis>
                        |<emphasis>start</emphasis>
                        |&quot;div&quot; &quot;{&quot; <emphasis>includeContent</emphasis>* &quot;}&quot;
start               ::= &quot;start&quot; <emphasis>assignMethod</emphasis> <emphasis>pattern</emphasis>
define              ::= <emphasis>identifier</emphasis> <emphasis>assignMethod</emphasis> <emphasis>pattern</emphasis>
assignMethod        ::= &quot;=&quot;
                        |&quot;|=&quot;
                        |&quot;&amp;=&quot;
nameClass           ::= <emphasis>name</emphasis>
                        |<emphasis>NCName</emphasis> &quot;:*&quot; [<emphasis>exceptNameClass</emphasis>]
                        |&quot;*&quot; [<emphasis>exceptNameClass</emphasis>]
                        |<emphasis>nameClass</emphasis> &quot;|&quot; <emphasis>nameClass</emphasis>
                        |&quot;(&quot; <emphasis>nameClass</emphasis> &quot;)&quot;
name                ::= <emphasis>identifierOrKeyword</emphasis>
                        |<emphasis>CName</emphasis>
exceptNameClass     ::= &quot;-&quot; <emphasis>nameClass</emphasis>
datatypeName        ::= <emphasis>CName</emphasis>
                        |&quot;string&quot;
                        |&quot;token&quot;
namespaceURILiteral ::= <emphasis>literal</emphasis>
                        |&quot;inherit&quot;
inherit             ::= &quot;inherit&quot; &quot;=&quot; <emphasis>identifierOrKeyword</emphasis>
identifierOrKeyword ::= <emphasis>identifier</emphasis>
                        |<emphasis>keyword</emphasis>
identifier          ::= (<emphasis>NCName</emphasis> - <emphasis>keyword</emphasis>)
                        |<emphasis>quotedIdentifier</emphasis>
quotedIdentifier    ::= &quot;\&quot; <emphasis>NCName</emphasis>
CName               ::= <emphasis>NCName</emphasis> &quot;:&quot; <emphasis>NCName</emphasis>
literal             ::= <emphasis>literalSegment</emphasis> (&quot;~&quot; <emphasis>literalSegment</emphasis>)+
literalSegment      ::= &quot;&quot;&quot; (<emphasis>Char</emphasis> - (&quot;&quot;&quot; <emphasis>newline</emphasis>))* &quot;&quot;&quot;
                        |&quot;'&quot; (<emphasis>Char</emphasis> - (&quot;'&quot; <emphasis>newline</emphasis>))* &quot;'&quot;
                        |&quot;&quot;&quot;&quot;&quot; ([&quot;&quot;&quot;] [&quot;&quot;&quot;] (<emphasis>Char</emphasis> - &quot;&quot;&quot;))* &quot;&quot;&quot;&quot;&quot;
                        |&quot;'''&quot; ([&quot;'&quot;] [&quot;'&quot;] (<emphasis>Char</emphasis> - &quot;'&quot;))* &quot;'''&quot;
keyword             ::= &quot;attribute&quot;
                        |&quot;default&quot;
                        |&quot;datatypes&quot;
                        |&quot;div&quot;
                        |&quot;element&quot;
                        |&quot;empty&quot;
                        |&quot;external&quot;
                        |&quot;grammar&quot;
                        |&quot;include&quot;
                        |&quot;inherit&quot;
                        |&quot;list&quot;
                        |&quot;mixed&quot;
                        |&quot;namespace&quot;
                        |&quot;notAllowed&quot;
                        |&quot;parent&quot;
                        |&quot;start&quot;
                        |&quot;string&quot;
                        |&quot;text&quot;
                        |&quot;token&quot;</programlisting>
    <para>Note that this EBNF dooesn't capture the restrictions applied after simplification. The simplification process and restrictions are detailed in &quot;Chapter 15: Simplification And Restrictions&quot;. The main restrictions are also mentioned for each element in this chapter in the section titled &quot;Restrictions&quot;.</para>
  </sect1>
  <sect1><title>EBNF production quick reference</title><refentry id="ch16-literalSegmentPythonicDouble">
      <refmeta>
        <refentrytitle>&quot;&quot;&quot;...&quot;&quot;&quot;</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2597441">
          <primary>&quot;&quot;&quot;...&quot;&quot;&quot;</primary>
        </indexterm>
        <refname>&quot;&quot;&quot;...&quot;&quot;&quot;</refname>
        <refpurpose>Literal segment enclosed in three double quotes</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>literalSegment</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;&quot;&quot;&quot;&quot; ([&quot;&quot;&quot;] [&quot;&quot;&quot;] (<emphasis>Char</emphasis> - &quot;&quot;&quot;))* &quot;&quot;&quot;&quot;&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>datatypeName literal</literal>, <literal>datatypes</literal>, <literal>external</literal>, <literal>include</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>&quot;&quot;&quot;...&quot;&quot;&quot;</literal> production describes literal segments enclosed in three double quotes. These segments can include any character except sequences of three double quotes.</para>
      </refsect1>
    </refentry><refentry id="ch16-literalSegmentDoubleQuote">
      <refmeta>
        <refentrytitle>&quot;...&quot;</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2593101">
          <primary>&quot;...&quot;</primary>
        </indexterm>
        <refname>&quot;...&quot;</refname>
        <refpurpose>Literal segment enclosed in double quotes</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>literalSegment</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;&quot;&quot; (<emphasis>Char</emphasis> - (&quot;&quot;&quot; <emphasis>newline</emphasis>))* &quot;&quot;&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>datatypeName literal</literal>, <literal>datatypes</literal>, <literal>external</literal>, <literal>include</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>&quot;...&quot;</literal> production describes literal segments enclosed in double quotes. These segments can include any character except newlines and double quotes.</para>
      </refsect1>
    </refentry><refentry id="ch16-literalSegmentPythonicSimple">
      <refmeta>
        <refentrytitle>'''...'''</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2598570">
          <primary>'''...'''</primary>
        </indexterm>
        <refname>'''...'''</refname>
        <refpurpose>Literal segment enclosed in three single quotes</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>literalSegment</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;'''&quot; ([&quot;'&quot;] [&quot;'&quot;] (<emphasis>Char</emphasis> - &quot;'&quot;))* &quot;'''&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>datatypeName literal</literal>, <literal>datatypes</literal>, <literal>external</literal>, <literal>include</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>'''...'''</literal> production describes literal segments enclosed in three single quotes. These segments can include any character except sequences of three single quotes.</para>
      </refsect1>
    </refentry><refentry id="ch16-literalSegmentSimpleQuote">
      <refmeta>
        <refentrytitle>'...'</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2594668">
          <primary>'...'</primary>
        </indexterm>
        <refname>'...'</refname>
        <refpurpose>Literal segment enclosed in single quotes</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>literalSegment</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;'&quot; (<emphasis>Char</emphasis> - (&quot;'&quot; <emphasis>newline</emphasis>))* &quot;'&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>datatypeName literal</literal>, <literal>datatypes</literal>, <literal>external</literal>, <literal>include</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>'...'</literal> production describes literal segments enclosed in single quotes. These segments can include any character except newlines and single quotes.</para>
      </refsect1>
    </refentry><refentry id="ch16-ch16-parenthesis-nc">
      <refmeta>
        <refentrytitle>(nameClass)</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2595932">
          <primary>(nameClass)</primary>
        </indexterm>
        <refname>(nameClass)</refname>
        <refpurpose>Container</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>nameClass</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;(&quot; <emphasis>nameClass</emphasis> &quot;)&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(nameClass)</literal>, <literal>*-nameClass</literal>, <literal>attribute</literal>, <literal>element</literal>, <literal>nameClass|nameClass</literal>, <literal>nsName exceptNameClass</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>(nameClass)</literal> container is useful to group together name classes combined through &quot;<literal>|</literal>&quot; (choice). This container is a name class and may be combined with other name classes. </para>
        <para>Even when such a container is not required, it may often be used to improve the readability of a schema.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
 element hr:* - ( hr:author | hr:name | hr:born | hr:died ) { anything }    
    </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch16-parenthesis">
      <refmeta>
        <refentrytitle>(pattern)</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2595181">
          <primary>(pattern)</primary>
        </indexterm>
        <refname>(pattern)</refname>
        <refpurpose>Container</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;(&quot; <emphasis>pattern</emphasis> &quot;)&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>(pattern)</literal> container is useful to group together patterns combined through &quot;<literal>,</literal>&quot; (ordered group),  &quot;<literal>|</literal>&quot; (choice) or &quot;<literal>&amp;</literal>&quot; (interleave). This container is a pattern and may be combined with other patterns or quantified using qualifiers. </para>
        <para>The operator &quot;<literal>,</literal>&quot;,  &quot;<literal>|</literal>&quot; or &quot;<literal>&amp;</literal>&quot; used within the <literal>(pattern)</literal> container defines how the sub patterns are combined and different operators cannot be mixed at the same level.</para>
        <para>Even when such a container is not required, it may often be used to improve the readability of a schema.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
 element name {
  text|(
   element first{text},
   element middle{text}?,
   element last{text}
  )}
  
 element foo {
  element out {empty} &amp;
  (
   element in1 {empty},
   element in2 {empty}
  )
 }
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-anyName">
      <refmeta>
        <refentrytitle>*-nameClass</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2597719">
          <primary>*-nameClass</primary>
        </indexterm>
        <refname>*-nameClass</refname>
        <refpurpose>Name class accepting any name.</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>nameClass</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;*&quot; [<emphasis>exceptNameClass</emphasis>]
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(nameClass)</literal>, <literal>*-nameClass</literal>, <literal>attribute</literal>, <literal>element</literal>, <literal>nameClass|nameClass</literal>, <literal>nsName exceptNameClass</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>anyName</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>anyName</literal> name class matches any name from any namespace. This wild spectrum may be restricted by embedding <literal>except</literal> name classes.</para>
        <para>The set of these names can be restricted using the optional <literal>exceptNameClass</literal> production.</para>
      </refsect1>
      <refsect1>
        <title>Restrictions:</title>
        <para>Within the scope of an element, the name classes of attributes cannot overlap. The same restriction applies to name classes of elements when these elements are combined by <literal>interleave</literal>.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
 foreign-elements = element * - (local:* | lib:* | hr:*) { anything }*
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-except2">
      <refmeta>
        <refentrytitle>-nameClass</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2594475">
          <primary>-nameClass</primary>
        </indexterm>
        <refname>-nameClass</refname>
        <refpurpose>Remove a name class from another</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

exceptNameClass     ::= &quot;-&quot; <emphasis>nameClass</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>*-nameClass</literal>, <literal>nsName exceptNameClass</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>except</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>except</literal> name class is used to remove a name class from another.</para>
      </refsect1>
      <refsect1>
        <title>Restrictions:</title>
        <para>It is impossible to use <literal>-nameClass</literal> to produce empty name classes by including &quot;anyName&quot; in an &quot;except&quot; name class or &quot;nsName&quot; in an &quot;except&quot; name class included in another &quot;nsName&quot;.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
 element hr:* - ( hr:author | hr:name | hr:born | hr:died ) { anything }
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-except1">
      <refmeta>
        <refentrytitle>-pattern</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2595588">
          <primary>-pattern</primary>
        </indexterm>
        <refname>-pattern</refname>
        <refpurpose>Remove a set of values from a <literal>data</literal></refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

exceptPattern       ::= &quot;-&quot; <emphasis>pattern</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>datatypeName param exceptPattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>except</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>except</literal> pattern is used to remove a set of values from a &quot;<literal>datatypeName param exceptPattern</literal>&quot; pattern.</para>
      </refsect1>
      <refsect1>
        <title>Restrictions:</title>
        <para>The <literal>-pattern</literal> pattern can only be used in the context of data and can only contain <literal>data</literal>, <literal>value</literal> and <literal>choice</literal> elements.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
   attribute available {xs:boolean - (xs:boolean &quot;false&quot;)}
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-CName">
      <refmeta>
        <refentrytitle>CName</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2594739">
          <primary>CName</primary>
        </indexterm>
        <refname>CName</refname>
        <refpurpose>Colonized names</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

CName               ::= <emphasis>NCName</emphasis> &quot;:&quot; <emphasis>NCName</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(nameClass)</literal>, <literal>attribute</literal>, <literal>datatypeName literal</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>nameClass|nameClass</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>CName</literal> production describes colonized names (i.e. names containing a colon) as two non colonized names separated by a colon (&quot;<literal>:</literal>&quot;).</para>
      </refsect1>
    </refentry><refentry id="ch16-quotedIdentifier">
      <refmeta>
        <refentrytitle>QuotedIdentifier</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2597724">
          <primary>QuotedIdentifier</primary>
        </indexterm>
        <refname>QuotedIdentifier</refname>
        <refpurpose>Quoted identifier</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

quotedIdentifier    ::= &quot;\&quot; <emphasis>NCName</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypes</literal>, <literal>default namespace</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>namespace</literal>, <literal>parent</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>QuotedIdentifier</literal> production describes quoted identifiers, i.e. non colonized names preceded by a <literal>\</literal>. This is needed to allow names which are the same than the keywords of the compact syntax.</para>
      </refsect1>
    </refentry><refentry id="ch16-ch16-top-level">
      <refmeta>
        <refentrytitle>Top level</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2602376">
          <primary>Top level</primary>
        </indexterm>
        <refname>Top level</refname>
        <refpurpose>Top level</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

topLevel            ::= <emphasis>decl</emphasis>* (<emphasis>pattern</emphasis>|<emphasis>grammarContent</emphasis>*)
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para/>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>Start symbol for the Relax NG compact syntax EBNF. The <literal>Top level</literal> production describes the top level structure of a Relax NG compact syntax document composed of an optional declaration section and of the actual schema composed of either a single <literal>pattern</literal> or a more complete <literal>grammarContent</literal>.</para>
      </refsect1>
    </refentry><refentry id="ch16-ch16-assignMethod">
      <refmeta>
        <refentrytitle>assignMethod</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2596409">
          <primary>assignMethod</primary>
        </indexterm>
        <refname>assignMethod</refname>
        <refpurpose>Define how to assign a content to <literal>start</literal> and named patterns.</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

assignMethod        ::= &quot;=&quot;
                        |&quot;|=&quot;
                        |&quot;&amp;=&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>div</literal>, <literal>grammar</literal>, <literal>include</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>assignMethod</literal> how the content of  <literal>start</literal> and named patterns are affected by a new definition. <literal>assignMethod</literal> which may take the values: &quot;<literal>=</literal>&quot; (definition), &quot;<literal>&amp;=</literal>&quot; (combination by interleave) or &quot;<literal>|=</literal>&quot; (combination by choice).</para>
      </refsect1>
    </refentry><refentry id="ch16-ch15-attribute">
      <refmeta>
        <refentrytitle>attribute</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2594909">
          <primary>attribute</primary>
        </indexterm>
        <refname>attribute</refname>
        <refpurpose>Pattern matching an attribute.</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;attribute&quot; <emphasis>nameClass</emphasis> &quot;{&quot; <emphasis>pattern</emphasis> &quot;}&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>attribute</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>attribute</literal> pattern matches an attribute. The name of the attribute is defined through a nameClass which may be either a single name or name class. Note unlike that, for the XML syntax, the content of an attribute is not defaulted to <literal>text</literal> and must always be explicitly defined.</para>
      </refsect1>
      <refsect1>
        <title>Restrictions:</title>
        <para>
          <itemizedList>
            <listItem>
              <para>After simplification, attributes patterns can only contain patterns relevant for text nodes.</para>
            </listItem>
            <listItem>
              <para>Attributes cannot be duplicated, either directly or through overlaping name classes.</para>
            </listItem>
            <listItem>
              <para>Attributes which have an infinite name class (<literal>anyName</literal> or <literal>nsName</literal>) must be enclosed in a <literal>oneOrMore</literal> (or <literal>zeroOrMore</literal> before simplification) pattern.</para>
            </listItem>
          </itemizedList>
        </para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>

attribute available { text }

attribute xml:lang { xsd:language }

attribute * - (local:* | lib:* | hr:*) { text }

      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch16-datatypeName">
      <refmeta>
        <refentrytitle>datatypeName</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2593135">
          <primary>datatypeName</primary>
        </indexterm>
        <refname>datatypeName</refname>
        <refpurpose>Datatype name</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

datatypeName        ::= <emphasis>CName</emphasis>
                        |&quot;string&quot;
                        |&quot;token&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>datatypeName literal</literal>, <literal>datatypeName param exceptPattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>datatypeName</literal> production defines what is a valid datatype name. <literal>CName</literal> (Colonized names) must be used for any datatype library except for the built in type library which has only two datatypes (<literal>string</literal> and <literal>token</literal>).</para>
      </refsect1>
    </refentry><refentry id="ch16-ch15-value">
      <refmeta>
        <refentrytitle>datatypeName literal</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2597145">
          <primary>datatypeName literal</primary>
        </indexterm>
        <refname>datatypeName literal</refname>
        <refpurpose>Match a text node and a value</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
[<emphasis>datatypeName</emphasis>] <emphasis>literal</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>value</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>datatypeName literal</literal> pattern matches a text node against a value using the semantic of a specified datatype to perform the comparison.</para>
        <para>When datatypeName is omitted, the default datatype (which is the token datatype from the Relax NG built in library) is used.</para>
      </refsect1>
      <refsect1>
        <title>Restrictions:</title>
        <para>The <literal>datatypeName literal</literal> pattern is meant for data oriented applications and can't be used in mixed content models.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
 &quot;0&quot;
 
 xs:integer &quot;0&quot;

 xs:boolean &quot;false&quot;

 attribute available {xs:boolean &quot;true&quot;}
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-data">
      <refmeta>
        <refentrytitle>datatypeName param exceptPattern</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2596911">
          <primary>datatypeName param exceptPattern</primary>
        </indexterm>
        <refname>datatypeName param exceptPattern</refname>
        <refpurpose><literal>data</literal> pattern</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
<emphasis>datatypeName</emphasis> [&quot;{&quot; <emphasis>param</emphasis>* &quot;}&quot;] [<emphasis>exceptPattern</emphasis>]
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>data</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>datatypeName param exceptPattern</literal> pattern matches a single text node and gives the possibility to restrict its values. This is different from the <literal>text</literal> pattern which matches zero or more text nodes and doesn't give any possibility to restrict the values of these text nodes. </para>
        <para>In this construction, the restrictions are applied through <literal>datatypeName</literal> which defines the datatype, the optional <literal>param</literal> which define additional parameters passed to the datatype library (when the datatype library is W3C XML Schema datatypes, these parameters are the W3C XML Schema facets) and the optional <literal>exceptPattern</literal> which defines exceptions, i.e. a set of values which are excluded by the <literal>exceptPattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>Restrictions:</title>
        <para>The <literal>datatypeName param exceptPattern</literal> pattern is meant for data oriented applications and can't be used in mixed content models.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
   attribute available {xs:boolean - (xs:boolean &quot;false&quot;)}
 
    element born {xs:date {
      minInclusive = &quot;1900-01-01&quot;
      maxInclusive = &quot;2099-12-31&quot;
      pattern = &quot;[0-9]{4}-[0-9]{2}-[0-9]{2}&quot;
    }}
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch16-datatypes">
      <refmeta>
        <refentrytitle>datatypes</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2598821">
          <primary>datatypes</primary>
        </indexterm>
        <refname>datatypes</refname>
        <refpurpose>Namespace declaration (to identify datatype libraries)</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>decl</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;datatypes&quot; <emphasis>identifierOrKeyword</emphasis> &quot;=&quot; <emphasis>literal</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para/>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>xmlns:</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>datatypes</literal> declaration assigns a prefix to a datatype library for the compact syntax like xmlns:xxx attributes in XML. Note that unlike XML namespace declarations, declarations for the Relax NG compact syntax in general (and <literal>datatypes</literal> declarations in particular) are global to a schema and cannot be redefined. The prefix <literal>xsd</literal> is predefined and bound to &quot;http://www.w3.org/2001/XMLSchema-datatypes&quot;.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
datatypes xs = &quot;http://www.w3.org/2001/XMLSchema-datatypes&quot;
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch16-decl">
      <refmeta>
        <refentrytitle>decl</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2601866">
          <primary>decl</primary>
        </indexterm>
        <refname>decl</refname>
        <refpurpose>Declarations</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

decl                ::= &quot;namespace&quot; <emphasis>identifierOrKeyword</emphasis> &quot;=&quot; <emphasis>namespaceURILiteral</emphasis>
                        |&quot;default&quot; &quot;namespace&quot; [<emphasis>identifierOrKeyword</emphasis>] &quot;=&quot; <emphasis>namespaceURILiteral</emphasis>
                        |&quot;datatypes&quot; <emphasis>identifierOrKeyword</emphasis> &quot;=&quot; <emphasis>literal</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para/>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>Declarations section of a Relax NG compact syntax schema. These declarations are global and common to the whole schema and include the namespace and datatype libraries declarations.</para>
      </refsect1>
    </refentry><refentry id="ch16-ch16-default-namespace">
      <refmeta>
        <refentrytitle>default namespace</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2596934">
          <primary>default namespace</primary>
        </indexterm>
        <refname>default namespace</refname>
        <refpurpose>Default namespace declaration</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>decl</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;default&quot; &quot;namespace&quot; [<emphasis>identifierOrKeyword</emphasis>] &quot;=&quot; <emphasis>namespaceURILiteral</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para/>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>xmlns</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>default namespace</literal> declaration defines the default namespace for the compact syntax like <literal>xmlns</literal> attributes in XML. An optional prefix may be assigned to the default namespace which may then be explicitly referenced. Note that unlike XML default namespace declarations, declarations for the Relax NG compact syntax in general (and <literal>default namespace</literal> declarations in particular) are global to a schema and cannot be redefined. A prefix can be assigned to the lack of namespace using the value <literal>&quot;&quot;</literal>.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
default namespace = &quot;http://eric.van-der-vlist.com/ns/library&quot;
default namespace local = &quot;&quot;
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-div1">
      <refmeta>
        <refentrytitle>div</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2594258">
          <primary>div</primary>
        </indexterm>
        <refname>div</refname>
        <refpurpose>Division (in the context of a <literal>grammar</literal>)</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>grammarContent</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;div&quot; &quot;{&quot; <emphasis>grammarContent</emphasis>* &quot;}&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>div</literal>, <literal>grammar</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>div</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>div</literal> element is provided to define logical divisions in Relax NG schemas. It has no effect on the validation and its purpose is to define a group of definitions within a <literal>grammar</literal> which may be annotated as a whole.</para>
        <para>In the context of a <literal>grammar</literal>, the content of a <literal>div</literal> element is the same than the content of a <literal>grammar</literal> (this means that <literal>div</literal> elements may be embedded in other <literal>div</literal> elements.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
 [
   xhtml:p [
     &quot;The content of the book element has been split in two named patterns:&quot;
   ]
 ]
 div {
   book-start =
     attribute id { text },
     isbn-element,
     title-element,
     author-element*
   book-end =
     author-element*,
     character-element*,
     attribute available { text }
 }



      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-element">
      <refmeta>
        <refentrytitle>element</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2597776">
          <primary>element</primary>
        </indexterm>
        <refname>element</refname>
        <refpurpose>Pattern matching an element</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;element&quot; <emphasis>nameClass</emphasis> &quot;{&quot; <emphasis>pattern</emphasis> &quot;}&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>element</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>element</literal> pattern matches an element. The name of the element is defined through a nameClass which may be either a single name or name class.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
element isbn { text }

element hr:born { text }

element title { attribute xml:lang { text }, text }

element * - (local:* | lib:* | hr:*) { anything }
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-empty">
      <refmeta>
        <refentrytitle>empty</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2597289">
          <primary>empty</primary>
        </indexterm>
        <refname>empty</refname>
        <refpurpose>Empty content</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;empty&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>empty</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>empty</literal> patterns is used to define elements which are empty, i.e. which have no children elements, text nor attributes. Note that it is mandatory to use this pattern in such case (<literal>element foo{}</literal> is not forbidden) and that there is no such thing as empty attributes (an attribute such as <literal>foo=&quot;&quot;</literal> is considered as having a value which is the empty string rather than be considered as being empty, i.e. having no value).</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
 element foo {
  element out {empty} &amp;
  (
   element in1 {empty},
   element in2 {empty}
  )
 }
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-externalRef">
      <refmeta>
        <refentrytitle>external</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2598612">
          <primary>external</primary>
        </indexterm>
        <refname>external</refname>
        <refpurpose>Reference to an external schema</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;external&quot; <emphasis>literal</emphasis> [<emphasis>inherit</emphasis>]
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>externalRef</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>external</literal> pattern is a reference to an external schema. This has the same effect than replacing the <literal>external</literal> pattern by the external schema considered as a pattern.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
 element university { element name { text }, external &quot;flat.rnc&quot; }

 element book { external &quot;book.rnc&quot; }
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-grammar">
      <refmeta>
        <refentrytitle>grammar</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2598111">
          <primary>grammar</primary>
        </indexterm>
        <refname>grammar</refname>
        <refpurpose>Grammar pattern</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;grammar&quot; &quot;{&quot; <emphasis>grammarContent</emphasis>* &quot;}&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>grammar</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>grammar</literal> pattern encapsulates the definitions of <literal>start</literal> and named patterns.</para>
        <para>The most common use of <literal>grammar</literal> is to validate XML documents and in this case the <literal>start</literal> pattern defines which elements may be used as the document root element. The <literal>grammar</literal> pattern may also be used as a way to write modular schemas and in this case the <literal>start</literal> pattern defines which nodes must be matched by the <literal>grammar</literal> at the location where it appears in the schema.</para>
        <para>In every case, the named patterns defined in a <literal>grammar</literal> are considered to be local to this <literal>grammar</literal>.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
 grammar {

  author-element= element author {
   attribute id {text},
   name-element,
   born-element,
   died-element?
  }

  book-element = element book {
   attribute id {text},
   attribute available {text},
   isbn-element,
   title-element,
   author-element *,
   character-element*
  }

  born-element = element born {text}

  character-element =  element character {
   attribute id {text},
   name-element,
   born-element,
   qualification-element
  }

  died-element = element died {text}

  isbn-element = element isbn {text}

  name-element = element name {text}

  qualification-element = element qualification {text}

  title-element = element title {attribute xml:lang {text}, text}

  start = element library {
   book-element +
  }
 }

      
 author-element =
   grammar
   {
      start =
         element author
         {
            attribute id { text },
            name-element,
            born-element,
            died-element?
         }
      name-element = element name { text }
      born-element = element born { text }
      died-element = element died { text }
   }


 
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch16-grammarContent">
      <refmeta>
        <refentrytitle>grammarContent</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2594089">
          <primary>grammarContent</primary>
        </indexterm>
        <refname>grammarContent</refname>
        <refpurpose>Content of a grammar</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

grammarContent      ::= <emphasis>start</emphasis>
                        |<emphasis>define</emphasis>
                        |&quot;div&quot; &quot;{&quot; <emphasis>grammarContent</emphasis>* &quot;}&quot;
                        |&quot;include&quot; <emphasis>literal</emphasis> [<emphasis>inherit</emphasis>] [&quot;{&quot; <emphasis>includeContent</emphasis>* &quot;}&quot;]
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>div</literal>, <literal>grammar</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>grammarContent</literal> production defines the content of a <literal>grammar</literal>.</para>
      </refsect1>
    </refentry><refentry id="ch16-identifier">
      <refmeta>
        <refentrytitle>identifier</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2598707">
          <primary>identifier</primary>
        </indexterm>
        <refname>identifier</refname>
        <refpurpose>Identifier</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

identifier          ::= (<emphasis>NCName</emphasis> - <emphasis>keyword</emphasis>)
                        |<emphasis>quotedIdentifier</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>datatypes</literal>, <literal>default namespace</literal>, <literal>div</literal>, <literal>element</literal>, <literal>external</literal>, <literal>grammar</literal>, <literal>include</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>namespace</literal>, <literal>parent</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>identifier</literal> production describes valid <literal>identifier</literal>s for the compact syntax, i.e. either quoted identifiers or the non colonized names which are not keywords.</para>
      </refsect1>
    </refentry><refentry id="ch16-ch15-define">
      <refmeta>
        <refentrytitle>identifier assignMethod pattern</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2592982">
          <primary>identifier assignMethod pattern</primary>
        </indexterm>
        <refname>identifier assignMethod pattern</refname>
        <refpurpose>Named pattern definition</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

define              ::= <emphasis>identifier</emphasis> <emphasis>assignMethod</emphasis> <emphasis>pattern</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>div</literal>, <literal>grammar</literal>, <literal>include</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>define</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>When <literal>identifier assignMethod pattern</literal> is embedded in a grammar, it defines a named pattern or combines a new definition with an existing one. Named pattern are global to a <literal>grammar</literal> and can be referenced by <literal>ref</literal> in the scope of their <literal>grammar</literal> and by <literal>parentRef</literal> in the scope of the grammars directly embedded in their <literal>grammar</literal>.</para>
        <para>When <literal>identifier assignMethod pattern</literal> is embedded in <literal>include</literal>, the new definition is a redefinition and replaces the definitions from the included grammar unless a <literal>combine</literal> attribute is specified in which case the definitions are combined.</para>
        <para>The combination is defined through the <literal>assignMethod</literal> which may take the values: &quot;<literal>=</literal>&quot; (definition), &quot;<literal>&amp;=</literal>&quot; (combination by interleave) or &quot;<literal>|=</literal>&quot; (combination by choice).</para>
      </refsect1>
      <refsect1>
        <title>Restrictions:</title>
        <para>Named patterns are always global and apply only to patterns and it is not possible to define and make reference to non patterns such as class names or datatype parameters.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>

 date-element = element born { xsd:data }
 
 date-element |= element died { xsd:date }
 
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-identifierOrKeyword">
      <refmeta>
        <refentrytitle>identifierOrKeyword</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2596251">
          <primary>identifierOrKeyword</primary>
        </indexterm>
        <refname>identifierOrKeyword</refname>
        <refpurpose>Identifier or keyword</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

identifierOrKeyword ::= <emphasis>identifier</emphasis>
                        |<emphasis>keyword</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(nameClass)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>datatypes</literal>, <literal>default namespace</literal>, <literal>element</literal>, <literal>external</literal>, <literal>include</literal>, <literal>nameClass|nameClass</literal>, <literal>namespace</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>identifierOrKeyword</literal> production either a valid <literal>identifier</literal> or a <literal>keyword</literal>.</para>
      </refsect1>
    </refentry><refentry id="ch16-ch15-include">
      <refmeta>
        <refentrytitle>include</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2597266">
          <primary>include</primary>
        </indexterm>
        <refname>include</refname>
        <refpurpose>Grammar merge</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>grammarContent</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;include&quot; <emphasis>literal</emphasis> [<emphasis>inherit</emphasis>] [&quot;{&quot; <emphasis>includeContent</emphasis>* &quot;}&quot;]
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>div</literal>, <literal>grammar</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>include</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>include</literal> pattern includes a grammar and merges its definitions with the definitions of the current grammar. The definitions of the included grammar may be redefined and overridden by the definitions embedded in the <literal>include</literal> pattern. Note that a schema must contain an explicit <literal>grammar</literal> definition in order to be included.</para>
        <para>The optional <literal>inherit</literal> production defines which namespaces are inherited from the included schema and <literal>includeContent</literal> allows to redefine definitions from the included schema.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
  include &quot;included.rnc&quot;

  include &quot;flat.rnc&quot; { start = book-element }

      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch16-includeContent">
      <refmeta>
        <refentrytitle>includeContent</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2598016">
          <primary>includeContent</primary>
        </indexterm>
        <refname>includeContent</refname>
        <refpurpose>Content of an <literal>include</literal> pattern.</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

includeContent      ::= <emphasis>define</emphasis>
                        |<emphasis>start</emphasis>
                        |&quot;div&quot; &quot;{&quot; <emphasis>includeContent</emphasis>* &quot;}&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>include</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>includeContent</literal> production defines the content of an <literal>include</literal>. The only difference with <literal>grammarContent</literal> is that <literal>includeContent</literal> doesn't allow embedded <literal>include</literal>.</para>
      </refsect1>
    </refentry><refentry id="ch16-inherit">
      <refmeta>
        <refentrytitle>inherit</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2596957">
          <primary>inherit</primary>
        </indexterm>
        <refname>inherit</refname>
        <refpurpose>Namespace inheritance</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

inherit             ::= &quot;inherit&quot; &quot;=&quot; <emphasis>identifierOrKeyword</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>external</literal>, <literal>include</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>inherit</literal> production is used in <literal>external</literal> and <literal>include</literal> statements to specify the prefixes of the namespaces which are inherited by the included file.</para>
      </refsect1>
    </refentry><refentry id="ch16-keyword">
      <refmeta>
        <refentrytitle>keyword</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2595329">
          <primary>keyword</primary>
        </indexterm>
        <refname>keyword</refname>
        <refpurpose>Keywords</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

keyword             ::= &quot;attribute&quot;
                        |&quot;default&quot;
                        |&quot;datatypes&quot;
                        |&quot;div&quot;
                        |&quot;element&quot;
                        |&quot;empty&quot;
                        |&quot;external&quot;
                        |&quot;grammar&quot;
                        |&quot;include&quot;
                        |&quot;inherit&quot;
                        |&quot;list&quot;
                        |&quot;mixed&quot;
                        |&quot;namespace&quot;
                        |&quot;notAllowed&quot;
                        |&quot;parent&quot;
                        |&quot;start&quot;
                        |&quot;string&quot;
                        |&quot;text&quot;
                        |&quot;token&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>datatypes</literal>, <literal>default namespace</literal>, <literal>element</literal>, <literal>external</literal>, <literal>include</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>namespace</literal>, <literal>parent</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>keyword</literal> production gives the list of keywords for the Relax NG compact syntax. Note that these keywords are reserved only when there is a risk of confusion and that they can be used, for instance, as element or attribute names without being quoted. When they are reserved, they can still be used as identifiers but need to be quoted.</para>
      </refsect1>
    </refentry><refentry id="ch16-ch15-list">
      <refmeta>
        <refentrytitle>list</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2601975">
          <primary>list</primary>
        </indexterm>
        <refname>list</refname>
        <refpurpose>Text node split</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;list&quot; &quot;{&quot; <emphasis>pattern</emphasis> &quot;}&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>list</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>list</literal> pattern splits a text node into tokens separated by white spaces to allow the validation of these tokens separately. This is most useful for validating lists of values.</para>
      </refsect1>
      <refsect1>
        <title>Restrictions:</title>
        <para>
          <itemizedList>
            <listItem>
              <para><literal>interleave</literal> cannot be used within <literal>list</literal>.</para>
            </listItem>
            <listItem>
              <para>The content of a <literal>list</literal> is only about data: it's forbidden to define <literal>element</literal>, <literal>attribute</literal> or <literal>text</literal> there.</para>
            </listItem>
            <listItem>
              <para>It's forbidden to embed <literal>list</literal> into <literal>list</literal>.</para>
            </listItem>
          </itemizedList>
        </para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
 attribute see-also {list {token*}}
 
 attribute dimensions {list {xsd:decimal, xsd:decimal, xsd:decimal, (&quot;inches&quot;|&quot;cm&quot;|&quot;mm&quot;)}}
 
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-literal">
      <refmeta>
        <refentrytitle>literal</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2595505">
          <primary>literal</primary>
        </indexterm>
        <refname>literal</refname>
        <refpurpose>Literal</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

literal             ::= <emphasis>literalSegment</emphasis> (&quot;~&quot; <emphasis>literalSegment</emphasis>)+
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>datatypeName literal</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>datatypes</literal>, <literal>default namespace</literal>, <literal>external</literal>, <literal>include</literal>, <literal>namespace</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>literal</literal> production describes literals as several segments of literals contained by the &quot;<literal>~</literal>&quot; sign.</para>
      </refsect1>
    </refentry><refentry id="ch16-literalSegment">
      <refmeta>
        <refentrytitle>literalSegment</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2594346">
          <primary>literalSegment</primary>
        </indexterm>
        <refname>literalSegment</refname>
        <refpurpose>Literal segment</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

literalSegment      ::= &quot;&quot;&quot; (<emphasis>Char</emphasis> - (&quot;&quot;&quot; <emphasis>newline</emphasis>))* &quot;&quot;&quot;
                        |&quot;'&quot; (<emphasis>Char</emphasis> - (&quot;'&quot; <emphasis>newline</emphasis>))* &quot;'&quot;
                        |&quot;&quot;&quot;&quot;&quot; ([&quot;&quot;&quot;] [&quot;&quot;&quot;] (<emphasis>Char</emphasis> - &quot;&quot;&quot;))* &quot;&quot;&quot;&quot;&quot;
                        |&quot;'''&quot; ([&quot;'&quot;] [&quot;'&quot;] (<emphasis>Char</emphasis> - &quot;'&quot;))* &quot;'''&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>datatypeName literal</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>datatypes</literal>, <literal>default namespace</literal>, <literal>external</literal>, <literal>include</literal>, <literal>namespace</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>literalSegment</literal> production describes literal segments as strings enclosed either in simple or double quotes or enclosed in three double or single quotes using a pythonic syntax.</para>
      </refsect1>
    </refentry><refentry id="ch16-ch15-mixed">
      <refmeta>
        <refentrytitle>mixed</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2601800">
          <primary>mixed</primary>
        </indexterm>
        <refname>mixed</refname>
        <refpurpose>Pattern for mixed content models</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;mixed&quot; &quot;{&quot; <emphasis>pattern</emphasis> &quot;}&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>mixed</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>mixed</literal> pattern is a shortcut for <literal>interleave</literal> with an embedded <literal>text</literal> pattern. It describes unordered content models where a text node may be included before and after each element. Note that Relax NG does not allow to add constraints on these text nodes.</para>
      </refsect1>
      <refsect1>
        <title>Restrictions:</title>
        <para>The limitations of <literal>interleave</literal> apply here:</para>
        <itemizedList>
          <listItem>
            <para>The <literal>mixed</literal> pattern cannot be used within a <literal>list</literal>.</para>
          </listItem>
          <listItem>
            <para>Elements within a <literal>mixed</literal> pattern cannot have overlapping name classes.</para>
          </listItem>
          <listItem>
            <para>There must no other &quot;text&quot; pattern in each set of patterns combined by <literal>mixed</literal></para>
          </listItem>
        </itemizedList>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
 element title {
  mixed {
   attribute xml:lang {text}&amp;
   element a {attribute href {text}, text} *
  }
 }

is equivalent to:

 element title {
  ( text &amp; (
   attribute xml:lang {text}&amp;
   element a {attribute href {text}, text} *
  )
 }

which itself is equivalent to:

 element title {
   text &amp; 
   attribute xml:lang {text}&amp;
   element a {attribute href {text}, text} *
 }

      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch16-name">
      <refmeta>
        <refentrytitle>name</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2595346">
          <primary>name</primary>
        </indexterm>
        <refname>name</refname>
        <refpurpose>Define a set of names that must be matched by an element or attribute.</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

name                ::= <emphasis>identifierOrKeyword</emphasis>
                        |<emphasis>CName</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(nameClass)</literal>, <literal>*-nameClass</literal>, <literal>attribute</literal>, <literal>element</literal>, <literal>nameClass|nameClass</literal>, <literal>nsName exceptNameClass</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>name</literal> name class defines sets of names which are singletons i.e. that match only one name. There is no other restriction than those of XML 1.0 and namespaces in XML 1.0 on such names and they can be either <literal>CName</literal> or <literal>identifierOrKeyword</literal> (in particular, even <literal>keyword</literal>s can be used as <literal>name</literal>s).</para>
      </refsect1>
    </refentry><refentry id="ch16-ch16-nameClass">
      <refmeta>
        <refentrytitle>nameClass</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2598827">
          <primary>nameClass</primary>
        </indexterm>
        <refname>nameClass</refname>
        <refpurpose>Define a set of names that must be matched by an element or attribute.</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

nameClass           ::= <emphasis>name</emphasis>
                        |<emphasis>NCName</emphasis> &quot;:*&quot; [<emphasis>exceptNameClass</emphasis>]
                        |&quot;*&quot; [<emphasis>exceptNameClass</emphasis>]
                        |<emphasis>nameClass</emphasis> &quot;|&quot; <emphasis>nameClass</emphasis>
                        |&quot;(&quot; <emphasis>nameClass</emphasis> &quot;)&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(nameClass)</literal>, <literal>*-nameClass</literal>, <literal>attribute</literal>, <literal>element</literal>, <literal>nameClass|nameClass</literal>, <literal>nsName exceptNameClass</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>nameClass</literal> production defines sets of names that must be matched by elements and attributes. Its simplest expression is to define a single <literal>name</literal> but specific wildcards can also be expressed as <literal>nameClass</literal>.</para>
      </refsect1>
    </refentry><refentry id="ch16-ch15-choice2">
      <refmeta>
        <refentrytitle>nameClass|nameClass</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2594935">
          <primary>nameClass|nameClass</primary>
        </indexterm>
        <refname>nameClass|nameClass</refname>
        <refpurpose>Choice between name classes</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>nameClass</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
<emphasis>nameClass</emphasis> &quot;|&quot; <emphasis>nameClass</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(nameClass)</literal>, <literal>*-nameClass</literal>, <literal>attribute</literal>, <literal>element</literal>, <literal>nameClass|nameClass</literal>, <literal>nsName exceptNameClass</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>choice</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>nameClass|nameClass</literal> production performs a choice between two name classes: a name will match <literal>nameClass|nameClass</literal> if and only if it matches at least one of the two alternatives.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
 element lib:* | hr:* { anything }
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch16-namespace">
      <refmeta>
        <refentrytitle>namespace</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2601701">
          <primary>namespace</primary>
        </indexterm>
        <refname>namespace</refname>
        <refpurpose>Namespace declaration</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>decl</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;namespace&quot; <emphasis>identifierOrKeyword</emphasis> &quot;=&quot; <emphasis>namespaceURILiteral</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para/>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>xmlns:</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>namespace</literal> declaration defines namespace prefixes for the compact syntax like xmlns:xxx attributes in XML. Note that unlike XML namespace declarations, declarations for the Relax NG compact syntax in general (and <literal>namespace</literal> declarations in particular) are global to a schema and cannot be redefined. A prefix can be assigned to the lack of namespace using the value <literal>&quot;&quot;</literal>. The <literal>xml</literal> prefix is predefined.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
namespace hr = &quot;http://eric.van-der-vlist.com/ns/person&quot;
namespace local = &quot;&quot;
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-namespaceURILiteral">
      <refmeta>
        <refentrytitle>namespaceURILiteral</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2594080">
          <primary>namespaceURILiteral</primary>
        </indexterm>
        <refname>namespaceURILiteral</refname>
        <refpurpose>Namespace URI Literal</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

namespaceURILiteral ::= <emphasis>literal</emphasis>
                        |&quot;inherit&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>default namespace</literal>, <literal>namespace</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>namespaceURILiteral</literal> production is used to specify a namespace URI and can either be a <literal>literal</literal> or the value &quot;<literal>inherit</literal> to specify that the namespace URI is inherited from the including file.</para>
      </refsect1>
    </refentry><refentry id="ch16-ch15-notAllowed">
      <refmeta>
        <refentrytitle>notAllowed</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2598742">
          <primary>notAllowed</primary>
        </indexterm>
        <refname>notAllowed</refname>
        <refpurpose>Not allowed</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;notAllowed&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>notAllowed</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>notAllowed</literal> pattern always fails. It can be used to provide abstract definitions which must be overridden before they can be used in a schema.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
  isbn-element |= notAllowed
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-nsName">
      <refmeta>
        <refentrytitle>nsName exceptNameClass</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2598451">
          <primary>nsName exceptNameClass</primary>
        </indexterm>
        <refname>nsName exceptNameClass</refname>
        <refpurpose>Name class for any name in a namespace</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>nameClass</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
<emphasis>NCName</emphasis> &quot;:*&quot; [<emphasis>exceptNameClass</emphasis>]
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(nameClass)</literal>, <literal>*-nameClass</literal>, <literal>attribute</literal>, <literal>element</literal>, <literal>nameClass|nameClass</literal>, <literal>nsName exceptNameClass</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>nsName</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>nsName exceptNameClass</literal> name class allows any name in a specific namespace.</para>
        <para>The namespace is defined by the <literal>nsName</literal> production and the set of these names can be restricted using the <literal>exceptNameClass</literal> production.</para>
      </refsect1>
      <refsect1>
        <title>Restrictions:</title>
        <para>Within the scope of an element, the name classes of attributes cannot overlap. The same restriction applies to name classes of elements when these elements are combined by <literal>interleave</literal>. It is impossible to use <literal>nsName exceptNameClass</literal> to produce empty name classes by including <literal>nsName exceptNameClass</literal> in an <literal>except</literal> name class included in another <literal>nsName</literal>.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
 element lib:* { anything }
 
 element hr:* - ( hr:author | hr:name | hr:born | hr:died ) { anything }

      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-param">
      <refmeta>
        <refentrytitle>param</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2594674">
          <primary>param</primary>
        </indexterm>
        <refname>param</refname>
        <refpurpose>Datatype parameter</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

param               ::= <emphasis>identifierOrKeyword</emphasis> &quot;=&quot; <emphasis>literal</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>datatypeName param exceptPattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>param</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>param</literal> production defines parameters passed to the datatype library to determine if a value is valid per a datatype. When the datatype library is the W3C XML Schema datatypes, these parameters are the facets of the datatype and they define additional restrictions to be applied. The name of the parameter is defined by <literal>identifierOrKeyword</literal> and its value defined by <literal>literal</literal><literal>param</literal>.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
    element born {xs:date {
      minInclusive = &quot;1900-01-01&quot;
      maxInclusive = &quot;2099-12-31&quot;
      pattern = &quot;[0-9]{4}-[0-9]{2}-[0-9]{2}&quot;
    }}
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-parentRef">
      <refmeta>
        <refentrytitle>parent</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2597389">
          <primary>parent</primary>
        </indexterm>
        <refname>parent</refname>
        <refpurpose>Reference to a named pattern from the parent grammar</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;parent&quot; <emphasis>identifier</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>parentRef</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>parent</literal> pattern is a reference to a named pattern belonging to the parent <literal>grammar</literal>, i.e. the <literal>grammar</literal> in which the current <literal>grammar</literal> is included. The scope of named pattern is usually limited to the <literal>grammar</literal> in which they are defined and the <literal>parent</literal> pattern provides a way to extend this scope and refer named pattern defined in the parent <literal>grammar</literal>.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
  born-element = parent born-element
 
 start =
    attribute id { parent id-content },
    attribute available { parent available-content },
    element isbn { parent isbn-content },
    element title { parent title-content },
    element author { parent author-content }*,
    element character { parent character-content }*

      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch16-pattern">
      <refmeta>
        <refentrytitle>pattern</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2597976">
          <primary>pattern</primary>
        </indexterm>
        <refname>pattern</refname>
        <refpurpose>Pattern</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

pattern             ::= &quot;element&quot; <emphasis>nameClass</emphasis> &quot;{&quot; <emphasis>pattern</emphasis> &quot;}&quot;
                        |&quot;attribute&quot; <emphasis>nameClass</emphasis> &quot;{&quot; <emphasis>pattern</emphasis> &quot;}&quot;
                        |<emphasis>pattern</emphasis> (&quot;,&quot; <emphasis>pattern</emphasis>)+
                        |<emphasis>pattern</emphasis> (&quot;&amp;&quot; <emphasis>pattern</emphasis>)+
                        |<emphasis>pattern</emphasis> (&quot;|&quot; <emphasis>pattern</emphasis>)+
                        |<emphasis>pattern</emphasis> &quot;?&quot;
                        |<emphasis>pattern</emphasis> &quot;*&quot;
                        |<emphasis>pattern</emphasis> &quot;+&quot;
                        |&quot;list&quot; &quot;{&quot; <emphasis>pattern</emphasis> &quot;}&quot;
                        |&quot;mixed&quot; &quot;{&quot; <emphasis>pattern</emphasis> &quot;}&quot;
                        |<emphasis>identifier</emphasis>
                        |&quot;parent&quot; <emphasis>identifier</emphasis>
                        |&quot;empty&quot;
                        |&quot;text&quot;
                        |[<emphasis>datatypeName</emphasis>] <emphasis>literal</emphasis>
                        |<emphasis>datatypeName</emphasis> [&quot;{&quot; <emphasis>param</emphasis>* &quot;}&quot;] [<emphasis>exceptPattern</emphasis>]
                        |&quot;notAllowed&quot;
                        |&quot;external&quot; <emphasis>literal</emphasis> [<emphasis>inherit</emphasis>]
                        |&quot;grammar&quot; &quot;{&quot; <emphasis>grammarContent</emphasis>* &quot;}&quot;
                        |&quot;(&quot; <emphasis>pattern</emphasis> &quot;)&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>div</literal>, <literal>element</literal>, <literal>grammar</literal>, <literal>include</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>none</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>A pattern is an atom of Relax NG schema which is matched against nodes from the instance document (elements, attributes, text nodes or token resulting of a split through <literal>list</literal>).</para>
      </refsect1>
    </refentry><refentry id="ch16-ch15-interleave">
      <refmeta>
        <refentrytitle>pattern&amp;pattern</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2594441">
          <primary>pattern&amp;pattern</primary>
        </indexterm>
        <refname>pattern&amp;pattern</refname>
        <refpurpose><literal>interleave</literal> Pattern</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
<emphasis>pattern</emphasis> (&quot;&amp;&quot; <emphasis>pattern</emphasis>)+
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>interleave</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>interleave</literal> pattern &quot;interleaves&quot; sub patterns, i.e. allows their leaves to be mixed in any relative order.</para>
        <para><literal>interleave</literal> is more than defining unordered groups as we can see on the following example: consider element &quot;a&quot; and the ordered group of element &quot;b1&quot; and &quot;b2&quot;. An unordered group of these two patterns would only allow element &quot;a&quot; followed by elements &quot;b1&quot; and &quot;b2&quot; or elements &quot;b1&quot; and &quot;b2 followed by element &quot;a&quot;. An <literal>interleave</literal> of these two patterns does allow these two combinations but also element &quot;b1&quot; followed by &quot;a&quot; followed by &quot;b2&quot;, i.e. a combination where the element &quot;a&quot; has been &quot;interleaved&quot; between elements &quot;b1&quot; and &quot;b2&quot;.</para>
        <para>The <literal>interleave</literal> behavior is the behavior applied to <literal>attribute</literal> patterns even when they are embedded in (ordered) <literal>group</literal> patterns (the reason for this is that XML 1.0 specifies that the relative order of attributes is not significant).</para>
        <para>Another case where <literal>interleave</literal> patterns are often needed is to described mixed content models, i.e. content models where <literal>text</literal> are interleaved between elements. A shortcut (the <literal>mixed</literal> pattern) has been defined for this case.</para>
        <para>Any number of patterns may be combine through the <literal>&amp;</literal> operator using this construct, but one should note that different operators (<literal>,</literal>, <literal>|</literal> and <literal>&amp;</literal>) cannot be mixed at the same level.</para>
      </refsect1>
      <refsect1>
        <title>Restrictions:</title>
        <para>
          <itemizedList>
            <listItem>
              <para>The <literal>pattern&amp;pattern</literal> pattern cannot be used within a <literal>list</literal>.</para>
            </listItem>
            <listItem>
              <para>Elements within a <literal>pattern&amp;pattern</literal> pattern cannot have overlapping name classes.</para>
            </listItem>
            <listItem>
              <para>There must be at most one &quot;text&quot; pattern in each set of patterns combined by <literal>pattern&amp;pattern</literal></para>
            </listItem>
          </itemizedList>
        </para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>

   element character {
    attribute id {text}&amp;
    element name {text}&amp;
    element born {text}&amp;
    element qualification {text}}
 
 element foo {
  element out {empty} &amp;
  (
   element in1 {empty},
   element in2 {empty}
  )
 }
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-zeroOrMore">
      <refmeta>
        <refentrytitle>pattern*</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2602257">
          <primary>pattern*</primary>
        </indexterm>
        <refname>pattern*</refname>
        <refpurpose><literal>zeroOrMore</literal> pattern</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
<emphasis>pattern</emphasis> &quot;*&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>zeroOrMore</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>A pattern qualified as <literal>zeroOrMore</literal> must be matched zero or more times (i.e. any number of times).</para>
      </refsect1>
      <refsect1>
        <title>Restrictions:</title>
        <para>The <literal>pattern*</literal> pattern cannot contain attribute definitions.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
      
   element author {
    attribute id {text},
    element name {text},
    element born {text},
    element died {text}?}* 
 
  book-element = element book {
   attribute id {text},
   attribute available {text},
   isbn-element,
   title-element,
   author-element *,
   character-element*
  }

      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-oneOrMore">
      <refmeta>
        <refentrytitle>pattern+</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2602108">
          <primary>pattern+</primary>
        </indexterm>
        <refname>pattern+</refname>
        <refpurpose><literal>oneOrMore</literal> pattern</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
<emphasis>pattern</emphasis> &quot;+&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>oneOrMore</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>A pattern qualified as <literal>oneOrMore</literal> must be matched one or more times.</para>
      </refsect1>
      <refsect1>
        <title>Restrictions:</title>
        <para>The <literal>pattern+</literal> pattern cannot contain attribute definitions.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
  start = element library {
   book-element +
  }
 
   attribute see-also {list {(&quot;0836217462&quot;|&quot;0345442695&quot;|&quot;0449220230&quot;|&quot;0449214044&quot;|&quot;0061075647&quot;)+}}

      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-group">
      <refmeta>
        <refentrytitle>pattern,pattern</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2595696">
          <primary>pattern,pattern</primary>
        </indexterm>
        <refname>pattern,pattern</refname>
        <refpurpose><literal>pattern,pattern</literal> pattern</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
<emphasis>pattern</emphasis> (&quot;,&quot; <emphasis>pattern</emphasis>)+
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>group</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>group</literal> pattern defines an ordered group of sub patterns (note that when <literal>attribute</literal> patterns are included in such a group, their order cannot be guaranteed). Any number of patterns may be combine through the <literal>,</literal> operator using this construct, but one should note that different operators (<literal>,</literal>, <literal>|</literal> and <literal>&amp;</literal>) cannot be mixed at the same level.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
      
   element author {
    attribute id {text},
    element name {text},
    element born {text},
    element died {text}?}*
 
   element lib:title { attribute xml:lang { text }, text }
   
   attribute dimensions {list {token, token, token, (&quot;inches&quot;|&quot;cm&quot;|&quot;mm&quot;)}}
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-optional">
      <refmeta>
        <refentrytitle>pattern?</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2602355">
          <primary>pattern?</primary>
        </indexterm>
        <refname>pattern?</refname>
        <refpurpose><literal>optional</literal> pattern</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
<emphasis>pattern</emphasis> &quot;?&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>optional</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>A pattern qualified as <literal>optional</literal> is optional, i.e. must be matched zero or one time.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>

    element died {text}?
 
  attribute see-also {list {token, token?, token?, token?}}
 
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-choice1">
      <refmeta>
        <refentrytitle>pattern|pattern</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2598664">
          <primary>pattern|pattern</primary>
        </indexterm>
        <refname>pattern|pattern</refname>
        <refpurpose><literal>choice</literal> pattern</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
<emphasis>pattern</emphasis> (&quot;|&quot; <emphasis>pattern</emphasis>)+
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>choice</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>choice</literal> pattern defines a choice between different patterns: it matches a node if and only if at least one of its sub-pattern matches this node.</para>
        <para>Any number of patterns may be combine through the <literal>|</literal> operator using this construct, but one should note that different operators (<literal>,</literal>, <literal>|</literal> and <literal>&amp;</literal>) cannot be mixed at the same level.</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>

 element name {
  text|(
   element first{text},
   element middle{text}?,
   element last{text}
  )}
 
   attribute available {&quot;true&quot;|&quot;false&quot;|&quot;who knows?&quot;}
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-start">
      <refmeta>
        <refentrytitle>start</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2593956">
          <primary>start</primary>
        </indexterm>
        <refname>start</refname>
        <refpurpose>Start of a grammar</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para/>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>

start               ::= &quot;start&quot; <emphasis>assignMethod</emphasis> <emphasis>pattern</emphasis>
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>div</literal>, <literal>grammar</literal>, <literal>include</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>start</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>start</literal> pattern defines the &quot;start&quot; of a <literal>grammar</literal>. When this grammar is used to validate a complete document, the <literal>start</literal> pattern defines which elements may be used as the document (root) element. When this grammar is embedded in another <literal>grammar</literal>, the <literal>start</literal> pattern describes which pattern should be applied at the location where the <literal>grammar</literal> is embedded. Like named pattern definitions, start patterns may be combined by <literal>choice</literal> or <literal>interleave</literal> and redefined when they are included in <literal>include</literal> patterns.</para>
        <para>The combination is defined through the <literal>assignMethod</literal> which may take the values: &quot;<literal>=</literal>&quot; (definition), &quot;<literal>&amp;=</literal>&quot; (combination by interleave) or &quot;<literal>|=</literal>&quot; (combination by choice).</para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
  start = element library {
   book-element +
  }
 
  start |= book-element
      </programlisting>
      </refsect1>
    </refentry><refentry id="ch16-ch15-text">
      <refmeta>
        <refentrytitle>text</refentrytitle>
      </refmeta>
      <refnamediv>
        <indexterm id="IXT-id2597196">
          <primary>text</primary>
        </indexterm>
        <refname>text</refname>
        <refpurpose>Pattern matching text nodes</refpurpose>
      </refnamediv>
      <refsect1>
        <title>Class:</title>
        <para>pattern</para>
      </refsect1>
      <refsynopsisdiv>
        <synopsis>
&quot;text&quot;
</synopsis>
      </refsynopsisdiv>
      <refsect1>
        <title>May be included in:</title>
        <para><literal>(pattern)</literal>, <literal>attribute</literal>, <literal>datatypeName param exceptPattern</literal>, <literal>element</literal>, <literal>list</literal>, <literal>mixed</literal>, <literal>pattern&amp;pattern</literal>, <literal>pattern*</literal>, <literal>pattern+</literal>, <literal>pattern,pattern</literal>, <literal>pattern?</literal>, <literal>pattern|pattern</literal>.</para>
      </refsect1>
      <refsect1>
        <title>XML syntax equivalent:</title>
        <para>text</para>
      </refsect1>
      <refsect1>
        <title>Description:</title>
        <para>The <literal>text</literal> pattern matches zero or more text nodes. The fact that a <literal>text</literal> pattern matches more than one text node has no effect when it is used in ordered content models (the data model used by Relax NG for XML documents is similar to the data model of XPath 1.0 and two text nodes cannot be adjacent) but makes a difference when a <literal>text</literal> pattern is used in <literal>interleave</literal>:adding a single <literal>text</literal> pattern in an <literal>interleave</literal> pattern has the effect of allowing any number of text nodes which can interleave before and after each element (note that the <literal>mixed</literal> pattern is provided as a shortcut to define these content models).</para>
      </refsect1>
      <refsect1>
        <title>Restrictions:</title>
        <para>No more than one <literal>text</literal> pattern can be included in an <literal>interleave</literal> pattern. </para>
      </refsect1>
      <refsect1>
        <title>Example:</title>
        <programlisting>
  element author {
   attribute id {text},
   element name {text},
   element born {text},
   element died {text}?}?

      </programlisting>
      </refsect1>
    </refentry></sect1>
</chapter>
